package it.tukano.treditor.engine.input;

import java.util.List;

public class EdtEngineInputListener implements EngineInputListener {
    
    private List<EngineInputListener> edtMutableCallbackListeners;

    /**
     * Instance initializer
     */
    public EdtEngineInputListener(List<EngineInputListener> mutableCallbacksList) {
        this.edtMutableCallbackListeners = mutableCallbacksList;
    }

    public void onLeftClick(final int x, final int y) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            
            @Override
            public void run() {
                for (EngineInputListener e : edtMutableCallbackListeners) {
                    e.onLeftClick(x, y);
                }
            }
        });
    }

    public void onRightClick(final int x, final int y) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            
            @Override
            public void run() {
                for (EngineInputListener e : edtMutableCallbackListeners) {
                    e.onRightClick(x, y);
                }
            }
        });
    }

    public void onMiddleClick(final int x, final int y) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            
            @Override
            public void run() {
                for (EngineInputListener e : edtMutableCallbackListeners) {
                    e.onMiddleClick(x, y);
                }
            }
        });
    }

    public void onLeftDown(final int x, final int y) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            
            @Override
            public void run() {
                for (EngineInputListener e : edtMutableCallbackListeners) {
                    e.onLeftDown(x, y);
                }
            }
        });
    }

    public void onRightDown(final int x, final int y) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            
            @Override
            public void run() {
                for (EngineInputListener e : edtMutableCallbackListeners) {
                    e.onRightDown(x, y);
                }
            }
        });
    }

    public void onMiddleDown(final int x, final int y) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            
            @Override
            public void run() {
                for (EngineInputListener e : edtMutableCallbackListeners) {
                    e.onMiddleDown(x, y);
                }
            }
        });
    }

    public void onLeftUp(final int x, final int y) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            
            @Override
            public void run() {
                for (EngineInputListener e : edtMutableCallbackListeners) {
                    e.onLeftUp(x, y);
                }
            }
        });
    }

    public void onRightUp(final int x, final int y) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            
            @Override
            public void run() {
                for (EngineInputListener e : edtMutableCallbackListeners) {
                    e.onRightUp(x, y);
                }
            }
        });
    }

    public void onMiddleUp(final int x, final int y) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            
            @Override
            public void run() {
                for (EngineInputListener e : edtMutableCallbackListeners) {
                    e.onMiddleUp(x, y);
                }
            }
        });
    }
}
